import 'package:flutter/material.dart';
import '../form_demo.dart';
import '../material_components.dart';
import '../input/input_main_demo.dart';
import '../dialog/dialog_demo.dart';
import '../mdc/mdc_main_demo.dart';

class MainMenuList extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MainMenuListView();
  }
}

class MainMenuListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        MainMenuListViewItem(
          title: 'FormDemo',
          page: FormDemo(),
        ),
        MainMenuListViewItem(
          title: 'MaterialComponentsDemo',
          page: MaterialComponentsDemo(),
        ),
        MainMenuListViewItem(
          title: 'InputMainDemo',
          page: InputMainDemo(),
        ),
        MainMenuListViewItem(
          title: 'DialogDemo',
          page: DialogDemo(),
        ),
        MainMenuListViewItem(
          title: 'MdcMainDemo',
          page: MdcMainDemo(),
        ),
      ],
    );
  }
}

class MainMenuListViewItem extends StatelessWidget {
  final String title;

  final Widget page;

  MainMenuListViewItem({this.title, this.page});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(title),
      onTap: () {
        Navigator.of(context)
            .push(MaterialPageRoute(builder: (context) => page));
      },
    );
  }
}
